<?php

namespace app\model;

use think\Model;


class Task extends Model
{
    protected $pk = 'taskid';
    public function getExtracommissionAttr($value){return sprintf("%.2f",$value);}
    public function getEmptypackagepriceAttr($value){return sprintf("%.2f",$value);}
    public function getTaskcommissionAttr($value){return sprintf("%.2f",$value);}
    public function getTaskmoneyAttr($value){return sprintf("%.2f",$value);}
    public function getTaskcostAttr($value){return sprintf("%.2f",$value);}
    public function getDepositAttr($value){return sprintf("%.2f",$value);}
    public function getPostagedepositAttr($value){return sprintf("%.2f",$value);}
    public function getPlatformpriceAttr($value){return sprintf("%.2f",$value);}
    public function getStartpriceAttr($value){return sprintf("%.2f",$value);}
    public function getEndpriceAttr($value){return sprintf("%.2f",$value);}
    public function getBuypriceex1Attr($value){return sprintf("%.2f",$value);}
    public function getBuypriceex2Attr($value){return sprintf("%.2f",$value);}
    public function getBuypriceAttr($value){return sprintf("%.2f",$value);}
    public function getImgurlAttr($value){return \tool\Url::FileConversionUrl($value);}
    public function getNoteimgurl1Attr($value){return \tool\Url::FileConversionUrl($value);}
	public function getNoteimgurl2Attr($value){return \tool\Url::FileConversionUrl($value);}
	public function getNoteimgurl3Attr($value){return \tool\Url::FileConversionUrl($value);}
    public function getHideShopnameAttr($value,$data){
        $str=$data['shopname'];
        $st='';
        $strlen = mb_strlen($str);
        for ($i=0;$i<$strlen;$i++){
            if($i%2==0){
                $st.=mb_substr($str, $i, 1, 'utf8');
            }else{
                $st.='*';
            }
        }
        return $st;
    }

    public function getPublishtypeAttr($value)
    {
        $status = [
            0 => '即时发布',
            1 => '定时发布',
            2 => '定时发布',
        ];
        return $status[$value];
    }

}